
<!DOCTYPE html>
<html lang="zh-CN">
  <head>
     <include file="Index/head" />
    <link href="__PUBLIC__/css/dashboard.css" rel="stylesheet">
    <style type="text/css">
    .show_table_fields{width:75%; background-color:#fff; border:5px solid #1977C7; position:fixed; left:20%; top:20%; display:none;}
    .close_fields{font-size: 20px;float: right; background-color:#fff; border:0 solid #fff;}
    </style>
  </head>

  <body>

    <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container-fluid">
        <div class="navbar-header">
<!--           <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button> -->
          <a class="navbar-brand" href="#">数据字典</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
          <ul class="nav navbar-nav navbar-right">
<!--             <li><a href="#">Dashboard</a></li>
            <li><a href="#">Settings</a></li>
            <li><a href="#">Profile</a></li>
            <li><a href="#">Help</a></li> -->
          </ul>
          <form class="navbar-form navbar-right">
            <input type="text" class="form-control" placeholder="Search...">
          </form>
        </div>
      </div>
    </nav>

    <div class="container-fluid">
      <div class="row">
        <div class="col-sm-3 col-md-2 sidebar">
          <include file="Index/menu" />
        </div>
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
          <h2 class="sub-header">数据表<span style="float:right;"><a href="{:U('Home/Database/add_table',array('dbid' => $dbid))}"><button type="button" class="btn btn-success">添加表</button></a></span></h2>
          <div class="table-responsive">
            <table class="table table-striped">
              <thead>
                <tr>
                  <th>TableName(英文)</th>
                  <th>TableName(中文)</th>
                  <th>引擎</th>
                  <th>编码方式</th>
                </tr>
              </thead>
              <tbody>
              <volist name="list" id="vo">
                <tr>
                  <td>{$vo.tb_name}</td>
                  <td>{$vo.tb_name_ch}</td>
                  <td>{$vo.engine}</td>
                  <td>{$vo.tb_encoding}</td>
                  <!-- <td style="width:54px;"><button type="button" dbid="{$vo.dbid}" tbid="{$vo.tbid}"  class="btn btn-success view_fields">查看</button></td> -->
                  <td style="width:54px;"><a href="{:U('Home/Database/view_fields',array('dbid' => $vo['dbid'],'tbid' => $vo['tbid']))}"><button type="button" class="btn btn-success">查看</button></a></td>
                  <td style="width:54px;"><a href="{:U('Home/Database/modify_table',array('dbid' => $vo['dbid'],'tbid' => $vo['tbid']))}"><button type="button" class="btn btn-info">修改</button></a></td>
                  <td style="width:54px;"><button type="button" class="btn btn-danger" onclick="javascript:del_table({$vo.tbid},{$dbid});">删除</button></td>
                </tr>
              </volist>
              </tbody>
            </table>
            {$show}
          </div>
        </div>
      </div>
    </div>
    <!-- <div class="show_table_fields">
        <button class="close_fields">×</button>
        <table class="table table-striped">
              <thead>
                <tr>
                  <th>序号</th>
                  <th>字段名(英文)</th>
                  <th>字段名(中文)</th>
                  <th>类型</th>
                  <th>主键</th>
                  <th>索引类型</th>
                  <th>符号</th>
                  <th>默认值</th>
                  <th>自增长</th>
                  <th>长度</th>
                  <th>备注</th>
                  <th>创建时间</th>
                </tr>
              </thead>
              <tbody class="circulation">
              </tbody>
        </table>
    </div> -->
      <include file="Index/footer" />
<script type="text/javascript">
    function del_table(tbid,dbid){
      // alert(tbid); alert(dbid); return;
        var r = confirm('确定删除该数据表?');
        if(r){
            var url = "{:U('Home/Database/del_table')}";
            var now_url = window.location.href;
            $.ajax({
                type:'post',
                url:url,
                data:{dbid:dbid,tbid:tbid},
                dataType:'json',
                success:function(data){
                    if(data==1){
                        window.location.href = now_url;
                    }
                }
            });
        }else{
            return false;
        }
    }
    // $(document).ready(function(){
    //     $(".close_fields").bind('click',function(){
    //         $(".show_table_fields").hide();
    //     });
    //     $(".view_fields").bind('click',function(){
    //         var dbid = $(this).attr('dbid');
    //         var tbid = $(this).attr('tbid');
    //         var url = "{:U('Home/Database/show_fields')}";
    //         $.ajax({
    //             type:'post',
    //             url:url,
    //             data:{dbid:dbid,tbid:tbid},
    //             dataType:'json',
    //             success:function(data){
    //                 $(".circulation").empty();
    //                 if(data != 0){
    //                     var html = '';
    //                     $.each(data,function(key,value){
                            
    //                         html += '<tr><th>'+value['rank'];
    //                         html += '</th><th>'+value['fl_name'];
    //                         html += '</th><th>'+value['fl_name_ch'];
    //                         html += '</th><th>'+value['type_name'];
    //                         html += '</th><th>'+value['iskey'];
    //                         html += '</th><th>'+value['index'];
    //                         html += '</th><th>'+value['isunsigned'];
    //                         html += '</th><th>'+value['default_value'];
    //                         html += '</th><th>'+value['extra_value'];
    //                         html += '</th><th>'+value['lengths'];
    //                         html += '</th><th>'+value['comment'];
    //                         html += '</th><th>'+value['ctime'];
    //                         html += '</th></tr>';
    //                     });

    //                     $(".circulation").append(html);
    //                 }
    //             }
    //         });

    //         $(".show_table_fields").show();
    //     });
    // });
</script>
  </body>
</html>
